title = "筛选结果页模板"
url = "/:slug|[a-z\_\-]+-[0-9\-\_]+-\d+.html$"
layout = "default"
==
function onStart() {
  $slugArr = explode('-', str_replace('.html', '', $this->param('slug')));
  $id = array_pop($slugArr);
  $this['paramKey'] = array_shift($slugArr);
  $this['paramValue'] = $slugArr;
  $this['paramValueJson'] = json_encode($slugArr);
  $this['strParamValue'] = join('-', $slugArr);
  $condition = ['id' => $id];
  $category = App::make('Jason\Ccshop\Controllers\Categories')->category($condition);
  if ($category) {
    $this['category'] = $category;
  } else {
    return redirect('/404');
  }
}
==
{% set filterData = catalog.getFilterProducts(category, paramKey, paramValue) %}
{% set products = filterData.products %}

{% set per = get('per', 20) %}
{% set currentPage = get('page', 1) %}
{% put page_title %}{% for feature in filterData.displayNames %}{{ feature.name.name }}: {{ feature.value.name }}. {% endfor %} {{ category.page_title }} - {% default %}{% endput %}
{% put pageurl %}{{ catalog.canonicalValue('catalog/filter-feature'|page, 'category')|raw }}{% endput %}
{% put nextprePageUrl %}
{% if filterData.products.nextPageUrl %}
<link rel="next" href="{{ filterData.products.nextPageUrl }}">
{% endif %}
{% endput %}
{% put meta_description %}{% for feature in filterData.displayNames %}{{ feature.name.name }}: {{ feature.value.name }}. {% endfor %} {{ category.meta_description }}{% endput %}
<div id="contents">
  {% partial 'header-campaign-message' %}
  {% partial 'breadcrumbs' product=product categories=product.categories  %}
	<section>
		<div class="m10 mt0" style="position:relative;">
			<div class="search_disp_sort_wrap box_list">
				<div class="search_disp_sort_txt">{{ 'Catalog'|_ }}</div>
				<div class="search_disp_limit_select selectCommonWrap box_list_main">
					<ul class="select_common">
						<li>{{ 'Products sort'|_ }}</li>
					</ul>
				</div>
			</div>
			<div id="categorySort" class="box_list_main">
				<a href="{{ 'catalog/filter-feature'|page({slug: 'price_asc-c-'~ category.id ~'.html'}) }}">{{ 'Price'|_ }}</a>
        <a href="{{ 'catalog/filter-feature'|page({slug: 'newness_desc-c-'~ category.id ~'.html'}) }}">{{ 'New products'|_ }}</a>
        <a href="{{ 'catalog/filter-feature'|page({slug: 'rating_desc-c-'~ category.id ~'.html'}) }}">{{ 'reviews'|_ }}</a>
        <a href="{{ 'catalog/filter-feature'|page({slug: 'popular_desc-c-'~ category.id ~'.html'}) }}">{{ 'Popularity values'|_ }}</a>
      </div>
		</div>
		<div class="searchpageConditionArea simple_list_item_top clearfix">
			<div class="fl">
				<p class="fnt_small mv10 lh120">{{ 'Total'|_ }}：{{ products.total }}{{ 'itens'|_ }}</p>
			</div>
		</div>
		<ul id="productsContent1" class="list_product_box clearfix mt5 twoColumn">
            {% for key, product in products %}
			<li class="list_product_item">
				<div class="box_list list_product_item_inner">
					<a class="list_product_link box_list_main" href="{{ product.url }}?rel=mlist">
						<div class="list_product_frame">
							<div class="list_product_img_block">
								<img class="productImgH" src="{{ product.getMainThumb(344, 420 ) }}">
							</div>
							{% if product.discount %}
								<div class="sale-label">{{ product.discount }} OFF</div>     
              {% endif %} 
							<div class="list_product_text_block mb5">
								<p class="list_product_brand rdstr">{{ product.name }}</p>
								<p class="list_product_brand rdstr">
									<b class="list_product_price force_color">{{ product.price|formatPrice }}</b>
									{% if product.list_price > 0 %}                                
								    <span class="old-price">{{ product.list_price|formatPrice }}</span>
	                {% endif %}
								</p> 
								<p class="list_product_brand rdstr">
                    <span class="reviewStar size1 star{{ product.rating | round }}" style="position:relative;top:2px;"></span>
                    {% if product.reviews.count > 0 %}
                    <span class="txtPoint">({{ product.reviews.count }} reviews)</span>
                    {% endif %}
                </p>                              
							</div>
							<span class="arrow"></span>
						</div>
					</a>
				</div>
			</li>
			{% endfor %}
		</ul>
		
    <form id="ajaxLoadFormoreproducts">
      <input id="ajaxLoadFormoreproducts_page" type="hidden" name="page" value="2" />
      <input id="ajaxLoadFormoreproducts_sort" type="hidden" name="sort" value="asc" />
      <input id="ajaxLoadFormoreproducts_category" type="hidden" name="category" value="{{ category.id }}" />
      <input id="ajaxLoadFormoreproducts_filters_key" type="hidden" name="filters[key]" value="{{ paramKey }}" />
      <input id="ajaxLoadFormoreproducts_filters_value" type="hidden" name="filters[value]" value="{{ paramValueJson }}" />
    </form>
    <div class="load_click load_click_c" id="view_more_preorder">
        <div id="wait_for_load_list_preorder" style="margin:10px 0;text-align:center;">
            <span id="wait_for_load_list_preorder_text" style="display: none">
            {{ 'Products loading has finished '|_ }}
            </span>
            <span id="wait_for_load_list_preorder_img" style="display: none">
            <img  src="{{ 'assets/images/loadingAnimation.gif'|theme }}" style="width:26px;height:26px;">
            </span>
        </div>
    </div>
    <button id="ajaxLoadFormoreproductsbutton" style="position:relative;width:95%;margin:10px auto;z-index:99;outline:none;font-size:14px;height:35px;">{{ 'See more'|_ }}</button>
    <nav class="corePager">
			<div class="corePager_btn"></div>
			<div class="corePager_info">{{ 'Total'|_ }}{{ products.total }}{{ 'Items'|_ }}</div>
			<div class="corePager_btn"></div>
		</nav>
    {% partial 'search_block' %}

	</section>
</div>
<link href="{{ 'assets/css/index.css'|theme }}" rel="stylesheet" type="text/css" />
<link href="{{ 'assets/css/shop.css'|theme }}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{{ 'assets/js/shop_product.js'|theme }}"></script>
<script type="text/javascript">
	$(function () {
	    $("ul.select_common li").click(function(){
	    	$("#categorySort").toggle();
	    });

      $(".sxSort").click(function(){
        $('body').addClass ("push-overflow");
      });

      $(".modal_list_close").click(function(){
        $('body').removeClass("push-overflow");
      });

      $("#lean_overlay").click(function(){
        $('body').removeClass("push-overflow");
      });

	});
</script>